---
name: useTextKnob
menu: Knobs
route: /use-text-knob
---

import { useState } from "react";
import { Playground } from "docz";
import { Inspector, useTextKnob } from "../../src/lib";

### useTextKnob(label, [initialValue])

Shows a text box in the inspector panel and returns the current text and a method to change the text.

- `label` - A label for the text box
- `initialValue` - the Initial value of the text box. Defaults to `""`;

#### Usage

```javascript
import { useTextKnob } from "retoggle";
```

<Playground>
{() => {
    const [text, setText] = useTextKnob("Name", "Hello World")

    return (
        <React.Fragment>
            <Inspector usePortal={false}/>
            {text}
        </React.Fragment>
    )

}}

</Playground>
